﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using OASys.Web.Base;
using Project.Web.Base.Utility;
using OASys.Entity;
using Project.Common;
using Project.Entity.Base;
using OASys.Biz.BizAccess;

namespace OASys.Web.Areas.ModuleWF.Models
{
	public class ModelWorkFlowIndex : BaseModel
	{
		private BizWFFlow bizWFFlow;
		private BaseSearch searchEntity;
		public BaseSearch SearchEntity
		{
			get
			{
				if (searchEntity == null)
					searchEntity = new BaseSearch();
				return searchEntity;
			}
			set { searchEntity = value; }
		}

		/// <summary>
		/// 日志列表grid数据源
		/// 作者：尤啸
		/// 时间：2012-06-27
		/// </summary>
		public IList<WFFlow> GridDataSources
		{
			get;
			set;
		}

		public void RetriveData()
		{

			//查询条件
			ExpressionCondition<WFFlow> condition = ExpressionCondition<WFFlow>.GetInstance();
			GridDataSources = bizWFFlow.PaginateListBy(SearchEntity._PageSize.Value,
					SearchEntity._PageIndex ?? 0,
					ref count,
					condition.ConditionExpression,
					SearchEntity._OrderName,
					SearchEntity.EnumOrderDirection);

			//分页加载
			PaginateHelperObject = PaginateHelper.ConstructPaginate(SearchEntity._PageSize.Value, count, SearchEntity._PageIndex ?? 0, SearchEntity, "SearchEntity");

		}
	}

	public class ModelWorkFlowCreate : BaseModel
	{
		private BizWFFlow bizWFFlow;

		public WFFlow WFFlow
		{
			get;
			set;
		}


		/// <summary>
		/// 新增或者修改
		/// </summary>
		/// <param name="sampleCreateModel"></param>
		public void Save()
		{
			bizWFFlow.SaveOrUpdate(WFFlow);
		}
	}
}